﻿using System;
using System.Collections.Generic;
using System.Text;
using WinnerCMS.PlugIn.Scheduler;
using System.IO;
namespace WinnerCMS.PlugIn.Task
{ 
    /// <summary>
    /// 开发调试用的
    /// </summary>
    public class WrtieTxt : IScheduler
    {
        /// <summary>
        /// 执行
        /// </summary>
        public void Execute(object parameterized)
        {
#if DEBUG
            string FILE_NAME = WinnerCMS.Common.HttpServer.MapPath("/SchedulerJob.txt");

            string c = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            bool flag = false;

            if (!File.Exists(FILE_NAME))
            {
                flag = true;
                StreamWriter sr = File.CreateText(FILE_NAME);
                sr.Close();
            }
            //向文件写入内容
            using (StreamWriter x = new StreamWriter(FILE_NAME, true, System.Text.Encoding.UTF8))
            {
                if (flag)
                    x.WriteLine("计划任务测试开始：");
                x.WriteLine( c);
                x.Close();
            }
#endif
        }
    }
}